package com.xcity.pomelo.response;

import com.xcity.db.entity.Player;
import com.xcity.game.shop.ShopItemTemplate;
import com.xcity.game.shop.ShopUtils;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class ShopBuyResponse extends Response {

	public int id; // 商品id
	public int numLimit; // 限购数量
	public int boughtNum; // 已购数量（有限购次数的才累计）
	
	public ShopBuyResponse(int serial, Player player, ShopItemTemplate item) {
		super(serial);
		this.id = item.getId();
		this.numLimit = item.getNumLimit();
		if (item.getNumLimit() > 0) {
			this.boughtNum = ShopUtils.getBoughtNumToday(player, item);
		}
	}

}
